<?php 
/*
 module:		订单列表
 create_time:	2024-05-06 12:04:06
 author:		
 contact:		
*/

namespace app\admin\service\Order;
use app\admin\model\Order\Index;
use think\exception\ValidateException;
use xhadmin\CommonService;

class IndexService extends CommonService {


 /**start**/
	/*
 	* @Description  列表数据
 	*/
	public static function indexList($where,$field,$order,$limit,$page){
		try{
//			$res = Index::where($where)->field($field)->order($order)->paginate(['list_rows'=>$limit,'page'=>$page])->toArray();
            $res = db("order")
                ->alias("o")
                ->join("user u","o.uid = u.uid","left")
                ->join('user_wechat uw',"o.uid = uw.uid","left")
                ->field("u.phone,o.order_id,o.order_son,o.uid,o.title,o.price,o.money,o.actual_price,o.pay_type,o.state,o.create_time,o.pay_time,o.level,o.update_time,uw.nickname,uw.headimgurl")
                ->order("o.order_id desc")
                ->paginate(['list_rows'=>$limit,'page'=>$page])->toArray();

		}catch(\Exception $e){
			abort(config('my.error_log_code'),$e->getMessage());
		}
		return ['rows'=>$res['data'],'total'=>$res['total']];
	}



    /**end**/



}

